<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::group('web', function () {
    Route::group('user', function () {
        Route::rule('login', '\app\webapi\controller\ApiUser::login');
//        Route::rule('tt', '\app\webapi\controller\Test::t1');
//        Route::rule('getFansOrderStatisticsByUser', '\app\webapi\controller\ApiUser::getFansOrderStatisticsByUser');
        Route::rule('log', function () {
            echo 11111;
        });
        Route::rule('checkInfo', 'app\webapi\controller\ApiUser::checkInfo');
        Route::rule('register', 'app\webapi\controller\ApiUser::register');
        Route::rule('qrAgain', 'app\webapi\controller\ApiUser::qrAgain');
        Route::rule('editNickname', 'app\webapi\controller\ApiUser::editNickname');
        Route::rule('getInfo', 'app\webapi\controller\ApiUser::getInfo');
        Route::rule('resetPwd', 'app\webapi\controller\ApiUser::resetPwd');//修改密码
        Route::rule('resetPwdSmsCode', 'app\webapi\controller\ApiUser::resetPwdSmsCode');//重置密码
        Route::rule('updateUserInfo', 'app\webapi\controller\ApiUser::updateUserInfoAPI');
        Route::rule('getFansList', 'app\webapi\controller\ApiUser::getFansList');
        Route::rule('getMyOrder', 'app\webapi\controller\ApiUser::getMyOrder');
        Route::rule('getMyOrderInfo', 'app\webapi\controller\ApiUser::getMyOrderInfo');
        Route::rule('getFansOrder', 'app\webapi\controller\ApiUser::getFansOrder');
        Route::rule('getFansOrderInfo', 'app\webapi\controller\ApiUser::getFansOrderInfo');
        Route::rule('logout', 'app\webapi\controller\ApiUser::logout');
        Route::rule('refreshToken', 'app\webapi\controller\ApiUser::refreshToken');
        Route::rule('whoIsRecommender', 'app\webapi\controller\ApiUser::whoIsRecommender');
        Route::rule('editReceiptCode', 'app\webapi\controller\ApiUser::editReceiptCode');
        Route::rule('getFansDataInfo', 'app\webapi\controller\ApiUser::getFansDataInfo');
        //没写的
        Route::rule('editAvatar', 'app\webapi\controller\ApiUser::editAvatar');
        Route::rule('updateOpenId', 'app\webapi\controller\ApiUser::updateOpenId');
    });
    /**快递相关 已完成 */
    Route::group('user_parcel', function () {
        Route::rule('getList', 'app\webapi\controller\ApiUserParcel::getList');
        Route::rule('needParcel', 'app\webapi\controller\ApiUserParcel::needParcel');
        Route::rule('ack', 'app\webapi\controller\ApiUserParcel::ack');
        Route::rule('delete', 'app\webapi\controller\ApiUserParcel::deletesh');
    });
    /** 收益相关 已完成*/
    Route::group('income', function () {
        Route::rule('getIncomeInfo', 'app\webapi\controller\ApiUserIncome::getIncomeInfo');
        Route::rule('getIncomeRecord', 'app\webapi\controller\ApiUserIncome::getIncomeRecord');
        Route::rule('getWithdrawalRecord', 'app\webapi\controller\ApiUserIncome::getWithdrawalRecord');
        Route::rule('withDrawal', 'app\webapi\controller\ApiUserIncome::withDrawal');
        Route::rule('getOrderSaleIncomeInfo', 'app\webapi\controller\ApiUserIncome::getOrderSaleIncomeInfo');
        Route::rule('getOrderSaleIncome', 'app\webapi\controller\ApiUserIncome::getOrderSaleIncome');
        Route::rule('getIncomeRecordNotSure', 'app\webapi\controller\ApiUserIncome::getIncomeRecordNotSure');
    });
    /** 用户商品相关 已完成*/
    Route::group('user_goods', function () {
        Route::rule('getGoodsDetail', 'app\webapi\controller\ApiUserGoods::getGoodsDetail');
        Route::rule('myGoods', 'app\webapi\controller\ApiUserGoods::myGoods');
        Route::rule('myPayedGoods', 'app\webapi\controller\ApiUserGoods::myPayedGoods');
        Route::rule('addCart', 'app\webapi\controller\ApiUserGoods::addCart');
        Route::rule('myCartList', 'app\webapi\controller\ApiUserGoods::myCartList');
        Route::rule('removeCart', 'app\webapi\controller\ApiUserGoods::removeCart');
        Route::rule('removeCartBatch', 'app\webapi\controller\ApiUserGoods::removeCartBatch');
        Route::rule('updateCart', 'app\webapi\controller\ApiUserGoods::updateCart');
        Route::rule('imBuyer', 'app\webapi\controller\ApiUserGoods::imBuyer');
        Route::rule('imSaler', 'app\webapi\controller\ApiUserGoods::imSaler');
        Route::rule('viewPayImg', 'app\webapi\controller\ApiUserGoods::viewPayImg');
        Route::rule('giveMe', 'app\webapi\controller\ApiUserGoods::giveMe');
        Route::rule('cancelOrder', 'app\webapi\controller\ApiUserGoods::cancelOrder');
        Route::rule('myFavGoods', 'app\webapi\controller\ApiUserGoods::myFavGoods');
    });

    /** 验证码相关 已完成*/
    Route::group('sms', function () {
        Route::rule('getCodeByRegister', 'app\webapi\controller\ApiSms::getCodeByRegister');
        Route::rule('getCodeByFindPwd', 'app\webapi\controller\ApiSms::getCodeByFindPwd');
    });

    /** 抢购相关 已完成*/
    Route::group('rush', function () {
        Route::rule('getUserGTime', 'app\webapi\controller\ApiRush::getUserGTime');
        Route::rule('setPayPic', 'app\webapi\controller\ApiRush::setPayPic');
        Route::rule('payPrepare', 'app\webapi\controller\ApiRush::payPrepare');
        Route::rule('aliPayPrepare', 'app\webapi\controller\ApiRush::aliPayPrepare');
        Route::rule('payAck', 'app\webapi\controller\ApiRush::payAck');
        Route::rule('disputeOrder', 'app\webapi\controller\ApiRush::disputeOrder');
        Route::rule('shoot', 'app\webapi\controller\ApiRush::shoot');
        Route::rule('getRushSchedule', 'app\webapi\controller\ApiRush::getRushSchedule'); // 有更新 v2
        Route::rule('getRushGoods', 'app\webapi\controller\ApiRush::getRushGoods'); // 有更新 v2
    });


    Route::group('oss', function () {
        Route::rule('getAuth', 'app\webapi\controller\ApiOss::getAuth');
    });

    Route::group('coupon', function () {
        Route::rule('getCouponList', 'app\webapi\controller\ApiCoupon::getCouponList');
    });
    Route::group('order', function () {
        Route::rule('purchasePrepare', 'app\webapi\controller\ApiOrder::purchasePrepare');
        Route::rule('alipayPurchasePrepare', 'app\webapi\controller\ApiOrder::alipayPurchasePrepare');
        Route::rule('purchaseAck', 'app\webapi\controller\ApiOrder::purchaseAck');
        Route::rule('addPayImg', 'app\webapi\controller\ApiOrder::addPayImg');
        Route::rule('submitOrder', 'app\webapi\controller\ApiOrder::submitOrder');
        Route::rule('submitShelvesOrder', 'app\webapi\controller\ApiOrder::submitShelvesOrder');
        Route::rule('cancelShelvesOrder', 'app\webapi\controller\ApiOrder::cancelShelvesOrder');
        Route::rule('viewOrder', 'app\webapi\controller\ApiOrder::viewOrder');
    });
    Route::group('address', function () {
        Route::rule('getList', 'app\webapi\controller\ApiAddress::getList');
        Route::rule('getDetail', 'app\webapi\controller\ApiAddress::getDetail');
        Route::rule('add', 'app\webapi\controller\ApiAddress::add');
        Route::rule('update', 'app\webapi\controller\ApiAddress::update');
        Route::rule('delete', 'app\webapi\controller\ApiAddress::delete');
    });

    Route::group('common', function () {
        Route::rule('getCategory', 'app\webapi\controller\ApiCommon::getCategory');
        Route::rule('getNotice', 'app\webapi\controller\ApiCommon::getNotice');
        Route::rule('getGoodsList', 'app\webapi\controller\ApiCommon::getGoodsList');
        Route::rule('getBannerList', 'app\webapi\controller\ApiCommon::getBannerList');
        Route::rule('getProtocolBaseUrl', 'app\webapi\controller\ApiCommon::getProtocolBaseUrl');
        Route::rule('getProtocol', 'app\webapi\controller\ApiCommon::getProtocol');
        Route::rule('getHandlingFeeRate', 'app\webapi\controller\ApiCommon::getHandlingFeeRate');
        Route::rule('getGoodsLaunchTime', 'app\webapi\controller\ApiCommon::getGoodsLaunchTime');
        Route::rule('getAllGoodsLaunchStatus', 'app\webapi\controller\ApiCommon::getAllGoodsLaunchStatus');
        Route::rule('getGoodsLaunchGain', 'app\webapi\controller\ApiCommon::getGoodsLaunchGain');
        Route::rule('setData', 'app\webapi\controller\ApiCommon::setData');
        Route::rule('test', 'app\webapi\controller\ApiCommon::test');
    });
    /** 先不弄 */
    Route::group('wx_pay', function () {
        Route::rule('getopenid', 'app\webapi\controller\ApiWxPay::getopenid');
    });
    /** 这个只有一个方法 不是外部调用的  内部用的  写在了 common.php 文件内   获取所有等级的推荐关系 */
//    Route::group('recommender', function () {
//        Route::rule('getopenid', 'ApiWxPay/getopenid');
//    });

})->AllowCrossDomain([
    'Access-Control-Allow-Origin' => 'http://localhost:8080',
    'Access-Control-Allow-Credentials' => 'true',
    'Access-Control-Max-Age' => 1800,
    'Access-Control-Allow-Headers' => 'Authorization,tid,content-type, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With',
    'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS'
]);
